package homework_01.home01;
import java.util.Scanner;
public class homework02 {
    public static void main(String[] args){
        int c=0;
        System.out.println("请输入0-1000的整数：");
        Scanner input= new Scanner (System.in);
        int a=input.nextInt();
        String b=a+"";
        for(char i:b.toCharArray()) {
            System.out.println(i);
            int t=(int)i-48;
            c=c+t;
        }
        System.out.println(c);
        System.out.println("*******方法二*******");
        int f=123;
        int d=f/100;
        int e=f/10%10;
        int g=f%100%10;
        int h=d+e+g;
        System.out.println(d);
        System.out.println(e);
        System.out.println(g);
        System.out.println(h);

    }
}
